<script>
	import Aegis from 'aegis-weex-sdk';
	// 首先需要通过 uni.requireNativePlugin("ModuleName") 获取 module 
	export default {
		onLaunch: function() {
			console.log('App Launch')
			const projectName = 'uniappApiExampleExt';
			uni.$aegis = new Aegis({
			  id: 'iHWefAYqWuCkDjhucc',
			  spa: true,
			  reportApiSpeed: true,
			  reportAssetSpeed: true,
			  pagePerformance: true,
			  hostUrl: 'https://tamaegis.com',
			});
			uni.$uploadToTAM = (eventString, sdkAppId) => {
			  uni.$aegis.reportEvent({
			    name: eventString.split('#')[0] || '',
			    ext1: eventString,
			    ext2: projectName,
			    ext3: sdkAppId,
			  });
			};
			uni.$createTrtcCloudUpload = sdkAppId => uni.$uploadToTAM('createTrtcCloud', sdkAppId);
			uni.$enterRoomSuccessUpload = sdkAppId => uni.$uploadToTAM('enterRoom-success', sdkAppId);
			uni.$enterRoomFailedUpload = (sdkAppId, errorMsg) => uni.$uploadToTAM(`enterRoom-failed#error: ${errorMsg}`, sdkAppId);
			uni.$onErrorUpload = (sdkAppId, errorMsg) => uni.$uploadToTAM(`onError-failed#error: ${errorMsg}`, sdkAppId);
			uni.$startLocalPreviewUpload = sdkAppId => uni.$uploadToTAM('startLocalPreview', sdkAppId);
			uni.$startRemoteViewSuccessUpload = sdkAppId => uni.$uploadToTAM('startRemoteView-success', sdkAppId);
			uni.$startRemoteViewFailedUpload = (sdkAppId, errorMsg) => uni.$uploadToTAM(`startRemoteView-failed#error: ${errorMsg}`, sdkAppId);
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style>

@import './common/trtc-nvue.css';
</style>
